/ Assembly List / LJCTextDataReaderLib / TextDataReader / GetValue

Namespace - LJCTextDataReaderLib


Parameters
i - The data field index.

Returns

The data field object value.

Syntax

C#
public Object GetValue(Int32 i)

Returns the object value of the data field at the specified index. (DE)

Remarks

This is a minimum required method.

Example

C#
using LJCTextDataReaderLib;

// The hasHeadingLine defaults to true if the parameter is not included.
TextDataReader textReader = new TextDataReader();

string[] lines = new string[]
{
    "FirstName, LastName",
    "John, Doe",
    "Jane, Doe"
};

// The field delimiter defaults to "," if the parameter is not included.
textReader.LJCSetLines(lines);

while(textReader.ReadLine())
{
    // Get the current line values as strings.
    for int index = 0; index < textReader.FieldCount; index++)
    {
        // All statements lines retrieve the same data.
        object data = textReader.GetValue(index);
        data = textReader[index];
    
        string name = textReader.GetName(index);
        data = textReader[name];
        
        DbColumn dataField = textReader.LJCDataFields[index];
        data = dataField.Value;
    }
}

Copyright © Lester J. Clark and Contributors.
Licensed under the MIT License.